library IEEE;
    use IEEE.std_logic_1164.all;
    use IEEE.numeric_bit.all;

entity MARMUX_logic is
    port(MARMUX: in bit;
         ADDR_out,IR_out: in unsigned(15 downto 0);
         MARMUX_out: out unsigned(15 downto 0));
     end entity MARMUX_logic;

architecture build of MARMUX_logic is
    begin
        process(MARMUX,ADDR_out,IR_out)
            begin
                if MARMUX =  '0' then
                    MARMUX_out <= "00000000" & IR_out(7 downto 0);
                elsif MARMUX = '1' then
                    MARMUX_out <= ADDR_out;
                end if;
            end process;
    end build;